<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>

        // 每一个函数都有一个属性叫做  prototype

        // 用来给实例化对象提供公有的属性和方法


        function Person(name , age , sex) {
            this.name = name ;
            this.age = age ;
            this.sex = sex ; 
        }

        // 所有实例共有的方法
        Person.prototype.say = function() {
            console.log('hi');
        }

        // 所有实例共有的属性
        Person.prototype.type = '人' ;


        const p1 = new Person('cc' , 18 , '女') ;
        const p2 = new Person('yy' , 18 , '女') ;

        p1.say();

        console.log(p1.say === p2.say);


    </script>
    
</body>
</html>